#include "error.h"

void err_sym_not_defined(char *name, long line, symbolt_t type) {
	printf(RED "[Syntax Error]" CLR GREEN ": %ld " CLR CYAN, line);
	switch(type) {
		case LABEL_DEF || LABEL_REF:
			printf("LABEL");
			break;
		case VARIABLE:
			printf("VARIABLE");
			break;
		default:
			printf("UNKNOWN");
	}
	printf(" %s " CLR "not defined.\n", name);
}

void err_sym_already_defined(symboll_t *a, char *name, long line, symbolt_t type) {
	printf(RED "[Syntax Error]" CLR GREEN ": %ld " CLR "attempt to define " CYAN, line);
	switch(type) {
		case LABEL_DEF:
			printf("LABEL");
			break;
		case LABEL_REF:
			printf("LABEL");
			break;
		case VARIABLE:
			printf("VARIABLE");
			break;
		default:
			printf("UNKNOWN");
	}
	printf(" %s " CLR "which is already defined as as " YELLOW, name);
	switch(a->type) {
		case LABEL_DEF:
			printf("LABEL");
			break;
		case LABEL_REF:
			printf("LABEL");
			break;
		case VARIABLE:
			printf("VARIABLE");
			break;
		default:
			printf("UNKNOWN");
	}
	printf(CLR " in line" GREEN ": %ld" CLR "\n", a->line);
}
